/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.nanosl.norg.ent;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author Thilina
 */
@Embeddable
public class PersonHasAddressPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "person_NIC")
    private String personNIC;
    @Basic(optional = false)
    @Column(name = "address_address_number")
    private String addressAddressNumber;
    @Basic(optional = false)
    @Column(name = "address_street")
    private String addressStreet;
    @Basic(optional = false)
    @Column(name = "address_city_city")
    private String addressCityCity;

    public PersonHasAddressPK() {
    }

    public PersonHasAddressPK(String personNIC, String addressAddressNumber, String addressStreet, String addressCityCity) {
        this.personNIC = personNIC;
        this.addressAddressNumber = addressAddressNumber;
        this.addressStreet = addressStreet;
        this.addressCityCity = addressCityCity;
    }

    public String getPersonNIC() {
        return personNIC;
    }

    public void setPersonNIC(String personNIC) {
        this.personNIC = personNIC;
    }

    public String getAddressAddressNumber() {
        return addressAddressNumber;
    }

    public void setAddressAddressNumber(String addressAddressNumber) {
        this.addressAddressNumber = addressAddressNumber;
    }

    public String getAddressStreet() {
        return addressStreet;
    }

    public void setAddressStreet(String addressStreet) {
        this.addressStreet = addressStreet;
    }

    public String getAddressCityCity() {
        return addressCityCity;
    }

    public void setAddressCityCity(String addressCityCity) {
        this.addressCityCity = addressCityCity;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (personNIC != null ? personNIC.hashCode() : 0);
        hash += (addressAddressNumber != null ? addressAddressNumber.hashCode() : 0);
        hash += (addressStreet != null ? addressStreet.hashCode() : 0);
        hash += (addressCityCity != null ? addressCityCity.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PersonHasAddressPK)) {
            return false;
        }
        PersonHasAddressPK other = (PersonHasAddressPK) object;
        if ((this.personNIC == null && other.personNIC != null) || (this.personNIC != null && !this.personNIC.equals(other.personNIC))) {
            return false;
        }
        if ((this.addressAddressNumber == null && other.addressAddressNumber != null) || (this.addressAddressNumber != null && !this.addressAddressNumber.equals(other.addressAddressNumber))) {
            return false;
        }
        if ((this.addressStreet == null && other.addressStreet != null) || (this.addressStreet != null && !this.addressStreet.equals(other.addressStreet))) {
            return false;
        }
        if ((this.addressCityCity == null && other.addressCityCity != null) || (this.addressCityCity != null && !this.addressCityCity.equals(other.addressCityCity))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.nanosl.norg.ent.PersonHasAddressPK[ personNIC=" + personNIC + ", addressAddressNumber=" + addressAddressNumber + ", addressStreet=" + addressStreet + ", addressCityCity=" + addressCityCity + " ]";
    }
    
}
